package com.syas.web.controllers;

import com.syas.service.interfaces.IFrmgerPfmceService;
import com.syas.service.interfaces.ITargetService;
import com.syas.web.auth.AuthPassport;
import com.syas.web.models.FrmgerPfmceSearchModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by weigong on 2015/12/5.
 */

@Controller
@RequestMapping(value = "/target")
public class TargetController extends  BaseController{

    @Autowired
    @Qualifier("TargetService")
    private ITargetService targetService;

    @AuthPassport
    @RequestMapping(value="/targetList", method = {RequestMethod.GET})
    public String targetList(HttpServletRequest request, Model model){
        model.addAttribute("first_tier_cities",targetService.getTargetListByCitygrade("1"));
        model.addAttribute("second_tier_cities",targetService.getTargetListByCitygrade("2"));
        model.addAttribute("third_line_cities",targetService.getTargetListByCitygrade("3"));
        model.addAttribute("four_cities",targetService.getTargetListByCitygrade("4"));
        model.addAttribute("requestUrl", request.getServletPath());
        model.addAttribute("requestQuery", request.getQueryString());
        return "target/targetList";
    }




}
